﻿@page "/tests/icons"

@inject IIconProvider IconProvider

<Row>
    <Column>
        <Card Margin="Margin.Is4.OnY">
            <CardHeader>
                <CardTitle>Icons</CardTitle>
            </CardHeader>
            <CardBody>
                <Field>
                    <TextEdit @bind-Text="@search" Placeholder="Search by name..." />
                </Field>
            </CardBody>
            <CardBody>
                <Div Flex="Flex.Row.Wrap.JustifyContent.Start.AlignItems.Start">
                    @foreach ( var icon in IconNames.Where( x => x.ToString().Contains( search ?? "", StringComparison.OrdinalIgnoreCase ) ) )
                    {
                        <Tooltip Text="@IconProvider.GetIconName(icon, IconStyle.Regular)">
                            <Div Flex="Flex.Column.JustifyContent.Center" Class="b-example-blazorise-icon">
                                <Span Flex="Flex.JustifyContent.Center.AlignItems.Center" Padding="Padding.Is5">
                                    <Icon Name="@icon" />
                                </Span>
                                <Text TextAlignment="TextAlignment.Center">
                                    @icon
                                </Text>
                            </Div>
                        </Tooltip>
                    }
                </Div>
            </CardBody>
        </Card>
    </Column>
</Row>

<Row>
    <Column>
        <Card Margin="Margin.Is4.OnY">
            <CardHeader>
                <CardTitle>Icon Sizes</CardTitle>
            </CardHeader>
            <CardBody>
                <Div Flex="Flex.Row.Wrap.JustifyContent.Start.AlignItems.Start">
                    @foreach ( var iconSize in Enum.GetValues<IconSize>() )
                    {
                        @if ( iconSize == IconSize.Default )
                            continue;

                        <Div Flex="Flex.Column.JustifyContent.Center">
                            <Span Flex="Flex.JustifyContent.Center.AlignItems.Center" Padding="Padding.Is5">
                                <Icon Name="IconName.Camera" IconSize="@iconSize" />
                            </Span>
                            <Text TextAlignment="TextAlignment.Center">
                                @iconSize
                            </Text>
                        </Div>
                    }
                </Div>
            </CardBody>
        </Card>
    </Column>
</Row>
@code {
    string search;

    IEnumerable<IconName> IconNames = Enum.GetValues<IconName>();
}